package com.rc.evcharger.common.type;

import com.rc.evcharger.common.utils.DataUtil;

import java.lang.reflect.Field;

/**
 * Create by Yang on 2019/11/11
 */
public class ChargeBalaceData extends BaseType implements DataType {

    public String status;

    public String orderNum;

    public String obligate = "00 00 00 00";


    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        String s = frameOrderNum(orderNum);
        this.orderNum = s;
    }

    public String getObligate() {
        return obligate;
    }

    public void setObligate(String obligate) {
        this.obligate = obligate;
    }

    private String frameOrderNum(String orderNum) {
        char[] c = orderNum.toCharArray();
        StringBuilder sb = new StringBuilder();
//        for (int i = 0; i < c.length; i++) {
//            if (i == 2) {
//                break;
//            }
//            sb.append("0").append(c[i]).append(DataUtil.SPLIT);
//        }
        for (int i = 0; i < c.length; i = i + 2) {
            sb.append(c[i]).append(c[i + 1]).append(DataUtil.SPLIT);
        }
        //sb.append("00");
        return sb.toString().trim();
    }

    @Override
    public boolean customField(Field field, StringBuffer sb) {
        return false;
    }
}
